/* Copyright 2012 Dustin Mitchell <dmmitche [at] gmail [dot] com>
 *
 * Licensed under the GPLv3.  See included LICENSE.txt for full details.
 */

#include <stdio.h>
#include <stdint.h>

#include "registers.h"

int main ()
{
  struct reg_map regs;
  volatile uint32_t *reg0;
  volatile uint32_t *reg1;
  volatile uint32_t *reg2;

  if (registers_map (&regs, 0x44e00000, SIZE_4K) == -1) {
    printf ("Unable to map registers\n");
    return 1;
  }

  reg0 = registers_get_reg_addr (&regs, 0, uint32_t);
  reg1 = registers_get_reg_addr (&regs, 4, uint32_t);
  reg2 = registers_get_reg_addr (&regs, 8, uint32_t);

  *reg0 = 10;
  *reg1 = 20;
  *reg2 = 99;

  registers_unmap (&regs);

  return 0;
}
